<template>
  <div id="quickIdentity" ref="driveridentitybox">
    <div class="showcardphoto" v-show="showcardIdphoto">
      <div class="quickCard_box">
        <div class="showcardimg_box" v-if="isweixin">
          <p v-if="identityPositiveUrl" @click="identityPositiveUpload">
            <img :src="identityPositiveUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="identityPositiveUpload">
            <img src="@/assets/imgs/idz.png" />
            <span>点击上传</span>
          </p>
          <p v-if="identityReverseUrl" @click="identityReverseUpload">
            <img :src="identityReverseUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="identityReverseUpload">
            <img src="@/assets/imgs/idf.png" />
            <span>点击上传</span>
          </p>
        </div>
        <div class="showcardimg_box" v-else>
          <div>
            <md-image-reader name="reader1" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="identityPositiveUrl" @click="identityPositiveUpload">
              <img :src="identityPositiveUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="identityPositiveUpload">
              <img src="@/assets/imgs/idz.png" />
              <span>点击上传</span>
            </p>
          </div>
          <div>
            <md-image-reader name="reader2" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="identityReverseUrl" @click="identityReverseUpload">
              <img :src="identityReverseUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="identityReverseUpload">
              <img src="@/assets/imgs/idf.png" />
              <span>点击上传</span>
            </p>
          </div>
        </div>
        <div class="showcardtext">
          <h6>身份证正反面</h6>
          <p>
            请按照示例图提交照片信息
            确保对齐、文字清晰、无反光、无遮挡
          </p>
        </div>
        <p class="cardBtn">
          <span class="cardcannel" @click="identityCannelBtn">取消</span>
          <span class="cardupload" @click="identityUploadBtn">上传</span>
        </p>
      </div>
    </div>
    <div class="showcardphoto" v-show="showdriverlicensephoto">
      <div class="quickCard_box">
        <div class="showcardimg_box" v-if="isweixin">
          <p v-if="cardPositiveUrl" @click="cardPositiveUpload">
            <img :src="cardPositiveUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="cardPositiveUpload">
            <img src="@/assets/imgs/sfxx_jsz_zheng@2x.png" />
            <span>点击上传</span>
          </p>
          <p v-if="cardReverseUrl" @click="cardReverseUpload">
            <img :src="cardReverseUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="cardReverseUpload">
            <img src="@/assets/imgs/sfxx_jsz_bei@2x.png" />
            <span>点击上传</span>
          </p>
        </div>
        <div class="showcardimg_box" v-else>
          <div>
            <md-image-reader name="reader3" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="cardPositiveUrl" @click="cardPositiveUpload">
              <img :src="cardPositiveUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="cardPositiveUpload">
              <img src="@/assets/imgs/sfxx_jsz_zheng@2x.png" />
              <span>点击上传</span>
            </p>
          </div>
          <div>
            <md-image-reader name="reader4" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="cardReverseUrl" @click="cardReverseUpload">
              <img :src="cardReverseUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="cardReverseUpload">
              <img src="@/assets/imgs/sfxx_jsz_bei@2x.png" />
              <span>点击上传</span>
            </p>
          </div>
        </div>
        <div class="showcardtext">
          <h6>驾驶证正反面</h6>
          <p>
            请按照示例图提交照片信息
            确保对齐、文字清晰、无反光、无遮挡
          </p>
        </div>
        <p class="cardBtn">
          <span class="cardcannel" @click="driverLicenCannelBtn">取消</span>
          <span class="cardupload" @click="cardUploadBtn">上传</span>
        </p>
      </div>
    </div>
    <div class="showcardphoto" v-show="showcardphoto">
      <div class="quickCard_box">
        <div class="showcardimg_box" v-if="isweixin">
          <p v-if="licensePositiveUrl" @click="licensePositiveUpload">
            <img :src="licensePositiveUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="licensePositiveUpload">
            <img src="@/assets/imgs/taxi_xsz_zheng@2x.png" />
            <span>点击上传</span>
          </p>
          <p v-if="licenseReverseUrl" @click="licenseReverseUpload">
            <img :src="licenseReverseUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="licenseReverseUpload">
            <img src="@/assets/imgs/taxi_xsz_bei@2x.png" />
            <span>点击上传</span>
          </p>
        </div>
        <div class="showcardimg_box" v-else>
          <div>
            <md-image-reader name="reader5" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="licensePositiveUrl" @click="licensePositiveUpload">
              <img :src="licensePositiveUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="licensePositiveUpload">
              <img src="@/assets/imgs/taxi_xsz_zheng@2x.png" />
              <span>点击上传</span>
            </p>
          </div>
          <div>
            <md-image-reader name="reader6" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="licenseReverseUrl" @click="licenseReverseUpload">
              <img :src="licenseReverseUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="licenseReverseUpload">
              <img src="@/assets/imgs/taxi_xsz_bei@2x.png" />
              <span>点击上传</span>
            </p>
          </div>
        </div>
        <div class="showcardtext">
          <h6>行驶证正反面</h6>
          <p>
            请按照示例图提交照片信息
            确保对齐、文字清晰、无反光、无遮挡
          </p>
        </div>
        <p class="cardBtn">
          <span class="cardcannel" @click="licenseCannelBtn">取消</span>
          <span class="cardupload" @click="licenseUploadBtn">上传</span>
        </p>
      </div>
    </div>
    <div class="showcardphoto" v-show="showMancarphoto">
      <div class="quickCard_box">
        <div class="showcardimg_box" v-if="isweixin">
          <p v-if="mancarUrl" @click="mancarReverseUpload">
            <img :src="mancarUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="mancarReverseUpload">
            <img src="@/assets/imgs/taxi_clxx_rchy@2x.png" />
            <span>点击上传</span>
          </p>
        </div>
        <div class="showcardimg_box" v-else>
          <div>
            <md-image-reader name="reader7" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="mancarUrl" @click="mancarReverseUpload">
              <img :src="mancarUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="mancarReverseUpload">
              <img src="@/assets/imgs/taxi_clxx_rchy@2x.png" />
              <span>点击上传</span>
            </p>
          </div>
        </div>
        <div class="showcardtext">
          <h6>人车合影</h6>
          <p>
            请按照示例图提交照片信息
            确保对齐、文字清晰、无反光、无遮挡
          </p>
        </div>
        <p class="cardBtn">
          <span class="cardcannel" @click="mancarCannelBtn">取消</span>
          <span class="cardupload" @click="mancarUploadBtn">上传</span>
        </p>
      </div>
    </div>
    <!--网约车资格证-->
    <div class="showcardphoto" v-show="showNetCardPhoto">
      <div class="quickCard_box">
        <div class="showcardimg_box" v-if="isweixin">
          <p v-if="netCardPositiveUrl" @click="netCardPositiveUpload">
            <img :src="netCardPositiveUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="netCardPositiveUpload">
            <img src="@/assets/imgs/wy_jiashizheng_zheng.png" />
            <span>点击上传</span>
          </p>
          <p v-if="netCardReverseUrl" @click="netCardReverseUpload">
            <img :src="netCardReverseUrl" />
            <span>点击上传</span>
          </p>
          <p v-else @click="netCardReverseUpload">
            <img src="@/assets/imgs/jiashizheng_fan.png" />
            <span>点击上传</span>
          </p>
        </div>
        <div class="showcardimg_box" v-else>
          <div>
            <md-image-reader name="reader8" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="netCardPositiveUrl" @click="netCardPositiveUpload">
              <img :src="netCardPositiveUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="netCardPositiveUpload">
              <img src="@/assets/imgs/wy_jiashizheng_zheng.png" />
              <span>点击上传</span>
            </p>
          </div>
          <div>
            <md-image-reader name="reader9" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
            <p v-if="netCardReverseUrl" @click="netCardReverseUpload">
              <img :src="netCardReverseUrl" />
              <span>点击上传</span>
            </p>
            <p v-else @click="netCardReverseUpload">
              <img src="@/assets/imgs/jiashizheng_fan.png" />
              <span>点击上传</span>
            </p>
          </div>
        </div>
        <div class="showcardtext">
          <h6>网约车证正反面</h6>
          <p>
            请按照示例图提交照片信息
            确保对齐、文字清晰、无反光、无遮挡
          </p>
        </div>
        <p class="cardBtn">
          <span class="cardcannel" @click="netCarCannelBtn">取消</span>
          <span class="cardupload" @click="netCardUploadBtn">上传</span>
        </p>
      </div>
    </div>
    <md-field>
      <md-field-item name title="服务城市" align="right" arrow="arrow-right" :value="selCityName" @click="selCity"></md-field-item>
    </md-field>
    <p class="driver_hd">个人信息</p>
    <div @click="personalPhotoUpload" v-if="isweixin">
      <md-field>
        <md-field-item name title="个人头像" align="right" arrow="arrow-right">
          <img :src="photoUrl" class="personalpoto" v-if="photoUrl" />
          <img src="@/assets/imgs/dt_cktx_big.png" class="personalpoto" v-else />
        </md-field-item>
      </md-field>
    </div>
    <div v-else class="personalpoto_box">
      <md-image-reader name="reader0" @complete="onImgComplete" :mime="['jpg','png','jpeg']"></md-image-reader>
      <md-field>
        <md-field-item name title="个人头像" align="right" arrow="arrow-right">
          <img :src="photoUrl" class="personalpoto" v-if="photoUrl" />
          <img src="@/assets/imgs/dt_cktx_big.png" class="personalpoto" v-else />
        </md-field-item>
      </md-field>
    </div>
    <md-field>
      <div @click="cardphotoBtn">
        <md-field-item name title="身份证照片" align="right" arrow="arrow-right" :value="cardphoto"></md-field-item>
      </div>
      <div @click="driverlicensephotoBtn">
        <md-field-item name title="驾驶证照片" align="right" arrow="arrow-right" :value="driverlicensephoto"></md-field-item>
      </div>
      <md-input-item title="姓氏" v-model="surname" placeholder="请输入姓氏" align="right" maxlength="2" @blur="getblur"></md-input-item>
      <md-input-item title="名字" v-model="username" placeholder="请输入名字" align="right" maxlength="3" @blur="getblur"></md-input-item>
      <md-input-item title="身份证号" placeholder="请输入身份证号" @blur="codeBlur" align="right" v-model="userId" maxlength="21"></md-input-item>
      <div @click="DatePickerShow">
        <md-field-item name title="初次领取驾照日期" align="right" arrow="arrow-right" :value="firstDate"></md-field-item>
      </div>
    </md-field>
    <div v-if="Iscard">
      <p class="driver_hd">紧急联系人</p>
      <md-field>
        <md-input-item ref="联系人姓名" title="联系人姓名" placeholder="请输入联系人姓名" align="right" v-model="urgentName" maxlength="5"></md-input-item>
        <md-input-item ref="联系人手机号" title="联系人手机号" placeholder="请输入联系人手机号" align="right" type="phone" v-model="urgentPhone" maxlength="11"></md-input-item>
      </md-field>
      <p class="driver_hd">行驶证信息</p>
      <div class="cardxs_box">
        <div class="card_number">
          <span>{{ abbreviation }}</span>
          <i></i>
          <span @click="getCardNumber">
            <b>{{ licenseplate }}</b>
            <img src="@/assets/imgs/sanjiao.png" />
          </span>
        </div>
        <md-field>
          <md-field-item name title="行驶证照片" align="right" arrow="arrow-right" :value="showpermittext" @click="showpermitphotoBtn"></md-field-item>
          <md-input-item ref="车牌号" title="车牌号" placeholder="请输入车牌号" align="right" v-model="cardNumber" maxlength="8"></md-input-item>
          <md-input-item ref="车辆型号" title="车辆型号" placeholder="请输入车辆型号" align="right" v-model="cardModel" maxlength="10"></md-input-item>
          <!-- <md-input-item ref="车辆颜色" title="车辆颜色" placeholder="请输入车辆颜色" align="right" v-model="cardColor">
          </md-input-item>-->
          <md-field-item name title="车辆颜色" align="right" arrow="arrow-right" :value="cardColor" @click="goColorCard"></md-field-item>
          <md-input-item ref="车辆所有人" title="车辆所有人" placeholder="请输入车辆所有人" align="right" v-model="carpeople" maxlength="5"></md-input-item>
          <md-field-item name title="车辆注册日期" align="right" arrow="arrow-right" :value="registrationDate" @click="registrationDateBtn"></md-field-item>
          <md-field-item name title="人车合影" align="right" arrow="arrow-right" :value="showMancartext" @click="showMancarphotoBtn"></md-field-item>
          <md-field-item name title="网约车证件照" align="right" arrow="arrow-right" :value="showNetCartext" @click="showNetCarBtn"></md-field-item>
        </md-field>
      </div>
    </div>
    <div class="companynextBtn" @click="savaQuickBtn">
      <p>保存提交</p>
    </div>
    <md-popup v-model="colorCardshoShow" position="bottom" :has-mask="true" prevent-scroll @hide="cancel">
      <md-popup-title-bar title="车辆颜色" ok-text cancel-text="取消" @cancel="cancel"></md-popup-title-bar>
      <div class="color_car_box">
        <md-scroll-view ref="scrollView" :auto-reflow="true" :scrolling-x="false" :bouncing="false">
          <div class="color_car">
            <ul>
              <li v-for="(item, index) in colorCardArr" :key="index" @click="getCarColor(item.name)">
                <span :style="'background-color:'+item.color"></span>
                {{item.name}}
              </li>
            </ul>
          </div>
        </md-scroll-view>
      </div>
    </md-popup>
    <md-date-picker
      ref="datePicker"
      v-model="isDatePickerShow"
      title="初次领取驾照日期"
      :minDate="minDate"
      :maxDate="maxDate"
      :default-date="currentDate"
      :unit-text="unitText"
      @confirm="onDatePickerConfirm"
    ></md-date-picker>
    <md-date-picker
      ref="registerdatePicker"
      v-model="isRegisterDatePickerShow"
      :unit-text="unitText"
      title="车辆注册日期"
      :minDate="minDate"
      :maxDate="maxDate"
      :default-date="currentDate"
      @confirm="onRegisterDatePickerConfirm"
    ></md-date-picker>
    <md-picker ref="picker" v-model="isshowCardNumber" :data="cardNumberData" :cols="2" is-cascade title="车牌号" @confirm="onPickerConfirm()"></md-picker>
  </div>
</template>
<script>
/* eslint-disable */
import {
  Icon,
  Field,
  FieldItem,
  InputItem,
  Toast,
  ScrollView,
  ImageReader,
  Dialog,
  Popup,
  PopupTitleBar,
  DatePicker,
  Picker
} from 'mand-mobile';
import Loading from '@/components/loading';
import { decryptByDESModeEBC, encryptByDESModeEBC } from '@/common/encrypt';
import http from '@/common/http';
import { Base64 } from 'js-base64';
import Utils from '@/common/pakjUtils';
import WxUtils from '@/common/weixinUtils';
import config from '@/common/config';
import CardNumber from '@/common/cardNumber';
import axios from 'axios';
import OSS from 'ali-oss';
let client = new OSS({
  region: 'oss-cn-qingdao',
  accessKeyId: 'LTAI0oUoBK7GwQn4',
  accessKeySecret: 'gHqAlhq2pX57Jz8XCO0zMLsKlZoAlX',
  bucket: 'pakj'
});
var moment = require('moment');
moment.locale('zh-cn');
export default {
  components: {
    [Icon.name]: Icon,
    [Field.name]: Field,
    [Toast.name]: Toast,
    [ImageReader.name]: ImageReader,
    [InputItem.name]: InputItem,
    [FieldItem.name]: FieldItem,
    [DatePicker.name]: DatePicker,
    [Popup.name]: Popup,
    [ScrollView.name]: ScrollView,
    [PopupTitleBar.name]: PopupTitleBar,
    [Picker.name]: Picker
  },
  data() {
    return {
      colorCardArr: [
        {
          color: '#fff',
          name: '白色'
        },
        {
          color: '#333',
          name: '黑色'
        },
        {
          color: '#ccc',
          name: '银色'
        },
        {
          color: '#FF3F40',
          name: '红色'
        },
        {
          color: '#B96700',
          name: '棕色'
        },
        {
          color: '#DAAB65',
          name: '金色'
        },
        {
          color: '#2781FF',
          name: '蓝色'
        },
        {
          color: '#57CC5C',
          name: '绿色'
        },
        {
          color: '#777777',
          name: '灰色'
        },
        {
          color: '#FFEBCC',
          name: '米色'
        },
        {
          color: '#FFDB5C',
          name: '黄色'
        },
        {
          color: '#9059FF',
          name: '紫色'
        },
        {
          color: '#6C3400',
          name: '褐色'
        },
        {
          color: '#FF9F9F',
          name: '粉色'
        },
        {
          color: '#FF7E00',
          name: '橙色'
        },
        {
          color: '',
          name: '其它'
        }
      ],
      isweixin: false,
      colorCardshoShow: false,
      selCityName: '选择服务城市',
      serviceCity: '',
      Iscard: true, // 是否有车
      Height: {
        height: ''
      },
      title: '平安到家车主注册',
      photoUrl: '', // 司机头像
      cardphoto: '请上传',
      driverlicensephoto: '请上传',
      showcardIdphoto: false,
      showdriverlicensephoto: false,
      surname: '', // 姓氏
      username: '', // 名字
      userId: '', // 身份证
      firstDate: '请选择',
      isDatePickerShow: false,
      minDate: new Date('1970/9/9'),
      maxDate: new Date(),
      currentDate: new Date(),
      unitText: ['', '', '', '', ''],
      urgentName: '', // 紧急联系人
      urgentPhone: '', // 紧急联系人电话
      showpermittext: '请上传',
      isshowCardNumber: false,
      cardNumber: '', // 车牌号
      abbreviation: '京',
      licenseplate: 'A',
      carpeople: '', // 车辆所有人
      cardModel: '', // 车辆型号
      cardColor: '请选择车辆颜色', // 车辆颜色
      registrationDate: '请选择',
      showMancartext: '请上传',
      showcardphoto: false,
      isRegisterDatePickerShow: false,
      showMancarphoto: false,
      cardNumberData: CardNumber.getdriverArea(),
      showNetCartext: '请上传',
      showNetcarphoto: false,
      identityPositiveUrl: '', // 身份证正面url地址
      identityReverseUrl: '', // 身份证反面url地址
      cardPositiveUrl: '', // 驾驶证正面url地址
      cardReverseUrl: '', // 驾驶证反面url地址
      licensePositiveUrl: '', // 行驶证正面
      licenseReverseUrl: '', // 行驶证反面
      mancarUrl: '', // 人车合一
      showNetCardPhoto: false,
      netCardPositiveUrl: '', // 网约车正面url地址
      netCardReverseUrl: '', // 网约车反面url地址
      identityPositiveImg: '', // 传入后台身份证正面url地址
      identityReverseImg: '', // 传入后台身份证反面url地址
      cardPositiveImg: '', // 传入后台驾驶证正面url地址
      cardReverseImg: '', // 传入后台驾驶证反面url地址
      licensePositiveImg: '', // 传入后台行驶证正面
      licenseReverseImg: '', // 传入后台行驶证反面
      mancarImg: '', // 传入后台人车合一
      netCardPositiveImg: '', // 传入后台网约车正面url地址
      netCardReverseImg: '', // 传入后台网约车反面url地址
      driverUploadType: '' // 上传图片类型
    };
  },
  created() {
    // 判断是否在微信浏览器
    if (Utils.isWeixinBroswer()) {
      WxUtils.wxConfig(['chooseImage', 'getLocalImgData']);
    }
  },
  mounted() {
    // 判断是否在微信浏览器
    if (Utils.isWeixinBroswer()) {
      this.isweixin = true;
    } else {
      this.isweixin = false;
    }
    // window.setCallbackUrl = this.setCallbackUrl;
    if (this.$route.query.type === '3') {
      this.Iscard = true;
      this.getheight();
    } else if (this.$route.query.type === '4') {
      this.Iscard = false;
    }
    // 身份信息回显
    if (this.$route.query.driverid) {
      var params = {
        driverId: this.$route.query.driverid
      };
      Loading.show();
      http.post('/pakj/cityDriver/getCityDriverInfoB', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          console.log(res.data);
          this.selCityName = sessionStorage['cityName'] || res.data.data.country;
          this.serviceCity = res.data.data.serviceCity;
          if (res.data.data.driverImg) {
            this.photoUrl = res.data.data.driverImg; // 司机头像
          }
          if (!res.data.data.driverIdPhoto) {
            this.cardphoto = '请上传';
          } else {
            this.identityPositiveUrl = res.data.data.driverIdPhoto; // 身份证正面
            this.identityPositiveImg = res.data.data.driverIdPhoto;
            this.cardphoto = '重新上传';
          }
          if (res.data.data.driverIdReversePhoto) {
            this.identityReverseUrl = res.data.data.driverIdReversePhoto; // 身份证反面
            this.identityReverseImg = res.data.data.driverIdReversePhoto;
          }
          if (!res.data.data.drivingLicensePhoto) {
            this.driverlicensephoto = '请上传';
          } else {
            this.driverlicensephoto = '重新上传';
            this.cardPositiveUrl = res.data.data.drivingLicensePhoto; // 驾驶证正面
            this.cardPositiveImg = res.data.data.drivingLicensePhoto;
          }
          if (res.data.data.drivingLicenseReversePhoto) {
            this.cardReverseUrl = res.data.data.drivingLicenseReversePhoto; // 驾驶证反面
            this.cardReverseImg = res.data.data.drivingLicenseReversePhoto;
          }
          if (!res.data.data.driverLicenseFirstTime) {
            this.firstDate = '请选择';
          } else {
            this.firstDate = moment(res.data.data.driverLicenseFirstTime, 'x').format('YYYY-MM-DD'); // 初次领取时间
          }
          if (res.data.data.driverIdNumber) {
            this.userId = decryptByDESModeEBC(res.data.data.driverIdNumber)
              .replace(/\s+/g, '')
              .replace(/(\S{6})(\S{4})(\S{4})(\S{4})/g, '$1 $2 $3 $4'); // 身份证号
          }
          this.urgentName = res.data.data.driverContactName; // 紧急联系人
          this.urgentPhone = decryptByDESModeEBC(res.data.data.driverContactPhone); // 紧急联系人电话
          this.username = res.data.data.name; // 司机名
          this.surname = res.data.data.surname; // 司机姓氏
          if (!res.data.data.drivingPermitPhoto) {
            this.showpermittext = '请上传';
          } else {
            this.licensePositiveUrl = res.data.data.drivingPermitPhoto; // 行驶证正面照片
            this.licensePositiveImg = res.data.data.drivingPermitPhoto;
            this.showpermittext = '重新上传';
          }
          if (!res.data.data.drivingPermitReversePhoto) {
            this.showpermittext = '请上传';
          } else {
            this.licenseReverseUrl = res.data.data.drivingPermitReversePhoto; // 行驶证反面照片
            this.licenseReverseImg = res.data.data.drivingPermitReversePhoto;
            this.showpermittext = '重新上传';
          }
          if (!res.data.data.plateNumber) {
            this.abbreviation = '京';
            this.licenseplate = 'A';
            this.cardNumber = '';
          } else {
            this.abbreviation = res.data.data.plateNumber.substring(0, 1);
            this.licenseplate = res.data.data.plateNumber.substring(1, 2);
            this.cardNumber = res.data.data.plateNumber.substring(2);
          }
          // 车辆颜色
          if (!res.data.data.carColour) {
            this.cardColor = '请选择车辆颜色';
          } else {
            this.cardColor = res.data.data.carColour;
          }
          // 车辆型号
          if (!res.data.data.carModel) {
            this.cardModel = '';
          } else {
            this.cardModel = res.data.data.carModel;
          }
          if (!res.data.data.carOwner) {
            this.carpeople = '';
          } else {
            this.carpeople = res.data.data.carOwner; // 车辆所有人
          }
          if (!res.data.data.carRegDate) {
            this.registrationDate = '请选择'; // 车辆注册时间
          } else {
            this.registrationDate = moment(res.data.data.carRegDate, 'x').format('YYYY-MM-DD'); // 车辆注册时间
          }
          if (!res.data.data.carAndPeoplePhoto) {
            this.mancarUrl = ''; // 人车合影
            this.showMancartext = '请上传';
          } else {
            this.mancarUrl = res.data.data.carAndPeoplePhoto; // 人车合影
            this.mancarImg = res.data.data.carAndPeoplePhoto;
            this.showMancartext = '重新上传';
          }
          if (!res.data.data.internetLicensePhoto) {
            this.showNetCartext = '请上传';
          } else {
            this.netCardPositiveUrl = res.data.data.internetLicensePhoto; // 网约车正面照片
            this.netCardPositiveImg = res.data.data.internetLicensePhoto;
            this.showNetCartext = '重新上传';
          }
          if (!res.data.data.internetLicenseReversePhoto) {
            this.showNetCartext = '请上传';
          } else {
            this.netCardReverseUrl = res.data.data.internetLicenseReversePhoto; // 网约车反面照片
            this.netCardReverseImg = res.data.data.internetLicenseReversePhoto;
            this.showNetCartext = '重新上传';
          }
        } else {
          Dialog.alert({
            title: '提示',
            content: res.data.msg,
            confirmText: '确定'
          });
        }
      });
    }
    if (sessionStorage['cityName']) {
      this.selCityName = sessionStorage['cityName'];
    }
  },
  methods: {
    getblur() {
      window.scroll(0, 0);
    },
    getheight() {
      this.Height.height = this.$refs.driveridentitybox.clientHeight + 'px';
    },
    // 选择颜色
    goColorCard() {
      this.colorCardshoShow = true;
    },
    cancel() {
      this.colorCardshoShow = false;
    },
    // 获取颜色
    getCarColor(name) {
      this.cardColor = name;
      this.colorCardshoShow = false;
    },
    selCity() {
      if (this.$route.query.driverid) {
        this.$router.push({
          name: 'cityList',
          query: {
            type: this.$route.query.type,
            driverphone: this.$route.query.driverphone,
            driverid: this.$route.query.driverid,
            serviceType: this.$route.query.serviceType,
            cardType: this.$route.query.cardType
          }
        });
      } else {
        this.$router.push({
          name: 'cityList',
          query: {
            type: this.$route.query.type,
            driverphone: this.$route.query.driverphone,
            serviceType: this.$route.query.serviceType,
            cardType: this.$route.query.cardType
          }
        });
      }
    },
    // 微信上传
    pullUpAppUpload(type) {
      wx.chooseImage({
        count: 1, // 默认9
        sizeType: ['compressed'], // 可以指定是原图还是压缩图，默认二者都有
        sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
        success: res => {
          wx.getLocalImgData({
            localId: res.localIds[0], // 图片的localID
            success: res => {
              if (
                Utils.getOSName()
                  .toLowerCase()
                  .indexOf('android') >= 0
              ) {
                res.localData = 'data:image/jpeg;base64,' + res.localData;
              }
              // console.log(res.localData);
              this.weixinUpload(res.localData, type);
            }
          });
        }
      });
    },
    weixinUpload(data, type) {
      Loading.show('上传中');
      var date = new Date();
      let typeImg = ''; // 上传图片属于那种类型 例如 驾驶证 行驶证 正反面
      switch (type) {
        case '0':
          typeImg = 'photo'; // 头像
          break;
        case '1':
          typeImg = 'identityPositive'; // 身份证正面
          break;
        case '2':
          typeImg = 'identityReverse'; // 身份证反面
          break;
        case '3':
          typeImg = 'cardPositive'; // 驾驶证正面
          break;
        case '4':
          typeImg = 'cardReverse'; // 驾驶证反面
          break;
        case '5':
          typeImg = 'licensePositive'; // 行驶证正面
          break;
        case '6':
          typeImg = 'licenseReverse'; // 行驶证反面
          break;
        case '7':
          typeImg = 'mancar'; // 车辆照片
          break;
        case '8':
          typeImg = 'netCardPositive'; // 网约车正面
          break;
        case '9':
          typeImg = 'netCardReverse'; // 网约车反面
          break;
      }
      var time = '' + date.getFullYear() + (date.getMonth() + 1) + date.getDate();
      var storeAs = 'incity/' + typeImg + '/' + time + '-' + date.getTime() + '.jpg';
      // blob转arrayBuffer
      var reader = new FileReader();
      reader.readAsArrayBuffer(this.dataURLtoFile(data));
      reader.onload = event => {
        var buffer = new OSS.Buffer(event.target.result);
        client
          .put(storeAs, buffer, {})
          .then(results => {
            let imgUrl = 'https://img.padj.group/' + results.name; // 照片回显
            switch (type) {
              case '0':
                this.photoUrl = imgUrl;
                Loading.hide();
                break;
              case '1':
                this.identityPositiveUrl = imgUrl;
                Loading.hide();
                break;
              case '2':
                this.identityReverseUrl = imgUrl;
                Loading.hide();
                break;
              case '3':
                this.cardPositiveUrl = imgUrl;
                Loading.hide();
                break;
              case '4':
                this.cardReverseUrl = imgUrl;
                Loading.hide();
                break;
              case '5':
                this.licensePositiveUrl = imgUrl;
                Loading.hide();
                break;
              case '6':
                this.licenseReverseUrl = imgUrl;
                Loading.hide();
                break;
              case '7':
                this.mancarUrl = imgUrl;
                Loading.hide();
                break;
              case '8':
                this.netCardPositiveUrl = imgUrl;
                Loading.hide();
                break;
              case '9':
                this.netCardReverseUrl = imgUrl;
                Loading.hide();
                break;
            }
          })
          .catch(err => {
            Loading.hide();
            console.log(err);
          });
      };
    },
    // h5图片上传
    onImgComplete(name, file) {
      Loading.show('上传中');
      if (file.file.type === 'image/jpeg' || file.file.type === 'image/png') {
        var date = new Date();
        let typeImg = ''; // 上传图片属于那种类型 例如 驾驶证 行驶证 正反面
        switch (name) {
          case 'reader0':
            typeImg = 'photo'; // 头像
            break;
          case 'reader1':
            typeImg = 'identityPositive'; // 身份证正面
            break;
          case 'reader2':
            typeImg = 'identityReverse'; // 身份证反面
            break;
          case 'reader3':
            typeImg = 'cardPositive'; // 驾驶证正面
            break;
          case 'reader4':
            typeImg = 'cardReverse'; // 驾驶证反面
            break;
          case 'reader5':
            typeImg = 'licensePositive'; // 行驶证正面
            break;
          case 'reader6':
            typeImg = 'licenseReverse'; // 行驶证反面
            break;
          case 'reader7':
            typeImg = 'mancar'; // 车辆照片
            break;
          case 'reader8':
            typeImg = 'netCardPositive'; // 网约车正面
            break;
          case 'reader9':
            typeImg = 'netCardReverse'; // 网约车反面
            break;
        }
        var time = '' + date.getFullYear() + (date.getMonth() + 1) + date.getDate();
        var storeAs = 'incity/' + typeImg + '/' + time + '-' + date.getTime() + '.' + file.file.name;
        // blob转arrayBuffer
        var reader = new FileReader();
        reader.readAsArrayBuffer(this.dataURLtoFile(file.dataUrl));
        reader.onload = event => {
          var buffer = new OSS.Buffer(event.target.result);
          client
            .put(storeAs, buffer, {})
            .then(results => {
              let imgUrl = 'https://img.padj.group/' + results.name; // 照片回显
              switch (name) {
                case 'reader0':
                  this.photoUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader1':
                  this.identityPositiveUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader2':
                  this.identityReverseUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader3':
                  this.cardPositiveUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader4':
                  this.cardReverseUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader5':
                  this.licensePositiveUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader6':
                  this.licenseReverseUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader7':
                  this.mancarUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader8':
                  this.netCardPositiveUrl = imgUrl;
                  Loading.hide();
                  break;
                case 'reader9':
                  this.netCardReverseUrl = imgUrl;
                  Loading.hide();
                  break;
              }
            })
            .catch(err => {
              Loading.hide();
              console.log(err);
            });
        };
      } else {
        Loading.hide();
        Dialog.alert({
          title: '提示',
          content: '图片格式错误',
          confirmText: '确定'
        });
      }
    },
    dataURLtoFile(dataurl) {
      const arr = dataurl.split(',');
      const mime = arr[0].match(/:(.*?);/)[1];
      const bstr = atob(arr[1]);
      let n = bstr.length;
      const u8arr = new Uint8Array(n);
      while (n--) {
        u8arr[n] = bstr.charCodeAt(n);
      }
      return new Blob([u8arr], { type: mime });
    },
    cardphotoBtn() {
      // 身份证
      this.showcardIdphoto = true;
    },
    driverlicensephotoBtn() {
      // 驾驶证
      this.showdriverlicensephoto = true;
    },
    codeBlur() {
      this.userId = this.userId.replace(/\s+/g, '').replace(/(\S{6})(\S{4})(\S{4})(\S{4})/g, '$1 $2 $3 $4');
      window.scroll(0, 0);
    },
    cardcannelBtn() {
      this.showMancarphoto = false;
      this.showNetCardPhoto = false;
    },
    // 身份证上传取消
    identityCannelBtn() {
      if (this.identityPositiveImg) {
        this.cardphoto = '重新上传';
      } else {
        this.identityPositiveUrl = '';
        this.identityReverseUrl = '';
        this.cardphoto = '请上传';
      }
      this.showcardIdphoto = false;
    },
    // 驾驶证上传取消
    driverLicenCannelBtn() {
      if (this.cardPositiveImg) {
        this.driverlicensephoto = '重新上传';
      } else {
        this.cardPositiveUrl = '';
        this.cardReverseUrl = '';
        this.driverlicensephoto = '请上传';
      }
      this.showdriverlicensephoto = false;
    },
    // 行驶证上传取消
    licenseCannelBtn() {
      if (this.licensePositiveImg) {
        this.showpermittext = '重新上传';
      } else {
        this.licensePositiveUrl = '';
        this.licenseReverseUrl = '';
        this.showpermittext = '请上传';
      }
      this.showcardphoto = false;
    },
    // 人车合影上传取消
    mancarCannelBtn() {
      if (this.mancarImg) {
        this.showMancartext = '重新上传';
      } else {
        this.mancarUrl = '';
        this.showMancartext = '请上传';
      }
      this.showMancarphoto = false;
    },
    // 网约车上传取消
    netCarCannelBtn() {
      if (this.netCardPositiveImg) {
        this.showNetCartext = '重新上传';
      } else {
        this.netCardPositiveUrl = '';
        this.netCardReverseUrl = '';
        this.showNetCartext = '请上传';
      }
      this.showNetCardPhoto = false;
    },
    DatePickerShow() {
      this.isDatePickerShow = true;
    },
    onDatePickerConfirm() {
      this.firstDate = this.$refs.datePicker.getFormatDate('yyyy-MM-dd');
    },
    onRegisterDatePickerConfirm() {
      this.registrationDate = this.$refs.registerdatePicker.getFormatDate('yyyy-MM-dd');
    },
    showpermitphotoBtn() {
      // 行驶证
      this.showcardphoto = true;
    },
    showMancarphotoBtn() {
      // 人车合影
      this.showMancarphoto = true;
    },
    showNetCarBtn() {
      // 网约车证件照
      this.showNetCardPhoto = true;
    },
    registrationDateBtn() {
      this.isRegisterDatePickerShow = true;
    },
    getCardNumber() {
      this.isshowCardNumber = true;
    },
    onPickerConfirm() {
      const values = this.$refs.picker.getColumnValues();
      let res = [];
      values.forEach(value => {
        res.push(value.text);
      });
      this.abbreviation = res[0]; // 省份简称
      this.licenseplate = res[1];
    },
    // 微信上传头像
    personalPhotoUpload() {
      let type = '0';
      this.pullUpAppUpload(type);
    },
    //  微信 身份证正面
    identityPositiveUpload() {
      let type = '1';
      this.pullUpAppUpload(type);
    },
    // 微信身份证反面
    identityReverseUpload() {
      let type = '2';
      this.pullUpAppUpload(type);
    },
    // 微信驾驶证正面
    cardPositiveUpload() {
      let type = '3';
      this.pullUpAppUpload(type);
    },
    // 微信驾驶证反面
    cardReverseUpload() {
      let type = '4';
      this.pullUpAppUpload(type);
    },
    // 微信行驶证正面
    licensePositiveUpload() {
      let type = '5';
      this.pullUpAppUpload(type);
    },
    // 微信行驶证反面
    licenseReverseUpload() {
      let type = '6';
      this.pullUpAppUpload(type);
    },
    // 微信人车合一
    mancarReverseUpload() {
      let type = '7';
      this.pullUpAppUpload(type);
    },
    // 微信网约车证 正面
    netCardPositiveUpload() {
      let type = '8';
      this.pullUpAppUpload(type);
    },
    // 微信网约车证 反面
    netCardReverseUpload() {
      let type = '9';
      this.pullUpAppUpload(type);
    },
    // 身份证上传
    identityUploadBtn() {
      if (!this.identityPositiveUrl) {
        Toast({
          content: '请上传身份证正面照片',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      if (!this.identityReverseUrl) {
        Toast({
          content: '请上传身份证反面照片',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      this.identityPositiveImg = this.identityPositiveUrl;
      this.identityReverseImg = this.identityReverseUrl;
      this.cardphoto = '重新上传';
      this.showcardIdphoto = false;
    },
    // 驾驶证上传
    cardUploadBtn() {
      if (!this.cardPositiveUrl) {
        Toast({
          content: '请上传驾驶证正面照片',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      if (!this.cardReverseUrl) {
        Toast({
          content: '请上传驾驶证反面照片',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      this.cardPositiveImg = this.cardPositiveUrl;
      this.cardReverseImg = this.cardReverseUrl;
      this.driverlicensephoto = '重新上传';
      this.showdriverlicensephoto = false;
    },
    // 行驶证上传
    licenseUploadBtn() {
      if (!this.licensePositiveUrl) {
        Toast({
          content: '请上传行驶证正面照片',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      if (!this.licenseReverseUrl) {
        Toast({
          content: '请上传行驶证反面照片',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      this.licensePositiveImg = this.licensePositiveUrl;
      this.licenseReverseImg = this.licenseReverseUrl;
      this.showpermittext = '重新上传';
      this.showcardphoto = false;
    },
    // 上传人车合一
    mancarUploadBtn() {
      if (!this.mancarUrl) {
        Toast({
          content: '请上传人车合影',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      this.mancarImg = this.mancarUrl;
      this.showMancartext = '重新上传';
      this.showMancarphoto = false;
    },
    // 上传网约车正面 反面照片
    netCardUploadBtn() {
      if (!this.netCardPositiveUrl) {
        Toast({
          content: '请上传网约车正面照片',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      if (!this.netCardReverseUrl) {
        Toast({
          content: '请上传网约车反面照片',
          duration: 3000,
          hasMask: true
        });
        return false;
      }
      this.netCardPositiveImg = this.netCardPositiveUrl;
      this.netCardReverseImg = this.netCardReverseUrl;
      this.showNetCartext = '重新上传';
      this.showNetCardPhoto = false;
    },
    // 保存提交
    savaQuickBtn() {
      if (this.$route.query.driverphone) {
        var regphone = /^1[23456789]\d{9}$/;
        var reg = /^[1-9][0-9]{5}([1][9][0-9]{2}|[2][0][0|1][0-9])([0][1-9]|[1][0|1|2])([0][1-9]|[1|2][0-9]|[3][0|1])[0-9]{3}([0-9]|[X]|[x])$/;
        var regCard = /^[0-9a-zA-Z]+$/;
        var regText = /^[\u4e00-\u9fa50-9a-zA-Z]+$/gi;
        var regTextone = /^[\u4e00-\u9fa50-9a-zA-Z]+$/gi;
        var regTexttwo = /^[\u4e00-\u9fa50-9a-zA-Z]+$/gi;
        var regTextthree = /^[\u4e00-\u9fa50-9a-zA-Z]+$/gi;
        var regTextfour = /^[\u4e00-\u9fa50-9a-zA-Z]+$/gi;
        var regTextfive = /^[\u4e00-\u9fa50-9a-zA-Z]+$/gi;
        if (this.selCityName === '选择服务城市') {
          Toast({
            content: '请选择服务城市',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!this.photoUrl) {
          Toast({
            content: '请上传司机头像',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!this.identityPositiveImg) {
          Toast({
            content: '请上传身份证正面照片',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!this.identityReverseImg) {
          Toast({
            content: '请上传身份证反面照片',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!this.cardPositiveImg) {
          Toast({
            content: '请上传驾驶证正面照片',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!this.cardReverseImg) {
          Toast({
            content: '请上传驾驶证反面照片',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!this.surname) {
          Toast({
            content: '请输入姓氏',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!regText.test(this.surname)) {
          Toast({
            content: '姓氏格式错误',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!this.username) {
          Toast({
            content: '请输入名字',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!regTextone.test(this.username)) {
          Toast({
            content: '名字格式错误',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (!this.userId) {
          Toast({
            content: '请输入身份证',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        var code = this.userId.replace(/\s+/g, '');
        if (!reg.test(code)) {
          Toast({
            content: '请输入正确的二代18位身份证号',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        if (this.firstDate === '请选择') {
          Toast({
            content: '请选择初次领取驾驶证日期',
            duration: 3000,
            hasMask: true
          });
          return false;
        }
        // 市内有车 才需验证
        if (this.$route.query.cardType === '1') {
          if (!this.urgentName) {
            Toast({
              content: '请输入紧急联系人',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!regTexttwo.test(this.urgentName)) {
            Toast({
              content: '紧急联系人格式错误',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!this.urgentPhone) {
            Toast({
              content: '请输入手机号',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!regphone.test(this.urgentPhone)) {
            Toast({
              content: '手机号格式错误',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!this.licensePositiveImg) {
            Toast({
              content: '请上传行驶证正面照片',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!this.licenseReverseImg) {
            Toast({
              content: '请上传行驶证反面照片',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!this.cardNumber) {
            Toast({
              content: '请输入车牌号',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!regCard.test(this.cardNumber)) {
            Toast({
              content: '车牌号格式错误',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!this.cardModel) {
            Toast({
              content: '请输入车辆型号',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!regTextthree.test(this.cardModel)) {
            Toast({
              content: '车辆型号格式错误',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (this.cardColor === '请选择车辆颜色') {
            Toast({
              content: '请选择车辆颜色',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!this.carpeople) {
            Toast({
              content: '请输入车辆所有人',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!regTextfive.test(this.carpeople)) {
            Toast({
              content: '车辆所有人格式错误',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (this.registrationDate === '请选择') {
            Toast({
              content: '请选择车辆注册日期',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          if (!this.mancarImg) {
            Toast({
              content: '请上传人车合影照片',
              duration: 3000,
              hasMask: true
            });
            return false;
          }
          // if (!this.netCardPositiveImg) {
          //     Toast({
          //         content: '请上传网约车正面照片',
          //         duration: 3000,
          //         hasMask: true
          //     });
          //     return false;
          // }
          // if (!this.netCardReverseImg) {
          //     Toast({
          //         content: '请上传网约车反面照片',
          //         duration: 3000,
          //         hasMask: true
          //     });
          //     return false;
          // }
        }
        let params = {
          driverPhone: this.$route.query.driverphone,
          type: this.$route.query.cardType,
          serviceCity: sessionStorage['cityId'] || this.serviceCity,
          driverImg: this.photoUrl, // 司机头像
          driverIdPhoto: this.identityPositiveImg, // 身份证正面
          driverIdReversePhoto: this.identityReverseImg, // 身份证反面
          driverIdNumber: encryptByDESModeEBC(code), // 身份证号
          drivingLicensePhoto: this.cardPositiveImg, // 驾驶证正面
          drivingLicenseReversePhoto: this.cardReverseImg, // 驾驶证反面
          driverLicenseFirstTime: moment(this.firstDate).valueOf(), // 初次领证时间
          driverContactName: this.urgentName, // 联系人姓名
          driverContactPhone: encryptByDESModeEBC(this.urgentPhone), // 联系人手机号
          driverName: this.username, // 请输入名字
          surname: this.surname, // 请输入姓氏
          drivingPermitPhoto: this.licensePositiveImg, // 行驶证照片
          drivingPermitReversePhoto: this.licenseReverseImg, // 行驶证反面照片
          plateNumber: this.abbreviation + this.licenseplate + this.cardNumber, // 车牌号
          carColour: this.cardColor, // 车辆颜色
          carModel: this.cardModel, // 车辆型号
          carOwner: this.carpeople, // 车辆所有人
          carRegDate: moment(this.registrationDate).valueOf(), // 车辆注册时间
          carAndPeoplePhoto: this.mancarImg, // 人车合影照片
          internetLicensePhoto: this.netCardPositiveImg, // 网约车正面照片
          internetLicenseReversePhoto: this.netCardReverseImg // 网约车反面照片
        };
        Loading.show();
        http.post('pakj/cityDriver/saveCityDriverInfo', params).then(res => {
          Loading.hide();
          if (res.data.code === '000000') {
            this.goDriverStatus();
            // 保存成功后清除sessionStorage
            sessionStorage.removeItem('cityId');
            sessionStorage.removeItem('cityName');
            sessionStorage.removeItem('backCity');
          } else {
            Dialog.alert({
              title: '提示',
              content: res.data.msg,
              confirmText: '确定'
            });
          }
        });
      } else {
        Dialog.alert({
          title: '提示',
          content: '获取不到手机号',
          confirmText: '确定'
        });
      }
    },
    goDriverStatus() {
      var params = {
        driverPhone: this.$route.query.driverphone
      };
      Loading.show();
      http.post('pakj/cityDriver/getCityDriverAuditInfoByPhone', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          sessionStorage['examineReason'] = res.data.data.auditRemarks;
          this.$router.push({
            name: 'driverStatus',
            query: {
              auditStatus: res.data.data.auditStatus,
              type: this.$route.query.type,
              driverphone: this.$route.query.driverphone,
              driverid: res.data.data.driverId
            }
          });
        } else {
          Dialog.alert({
            title: '提示',
            content: res.data.msg,
            confirmText: '确定'
          });
        }
      });
    }
    // 设置返回首页
    /* eslint-disable */
    // setReturn() {
    //     var type = {
    //         type: '1'
    //     };
    //     var os = Utils.getOSName();
    //     if ((os === 'Linux' || os === 'Android') && handler) {
    //         handler.setTopReturn(JSON.stringify(type));
    //     } else if ((os === 'iOS' || os === 'MacOSX') && window.webkit) {
    //         window.webkit.messageHandlers.setTopReturn.postMessage(JSON.stringify(type));
    //     }
    // },
    // setCallbackUrl() {
    //     window.location.href = config.pageUrl + 'taxi/#/register/drivertype?driverphone=' + this.$route.query.driverphone;
    // }
  }
};
</script>
<style lang="stylus">
p {
  display: block;
  margin-block-start: 0px;
  margin-block-end: 0px;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
}

h6 {
  display: block;
  font-size: 22px;
  margin-block-start: 0em;
  margin-block-end: 0em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  font-weight: 400;
}

.showcardphoto {
  position: fixed;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.quickCard_box {
}

.showcardimg_box {
  width: 600px;
  margin: auto;
}

.showcardimg_box p {
  margin-top: 10px;
  position: relative;
}

.showcardimg_box p img {
  width: 600px;
  height: 340px;
}

.md-image-reader {
  width: 600px;
  height: 340px;
}

.showcardimg_box p span {
  width: 200px;
  height: 88px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  display: inline-block;
  line-height: 88px;
  text-align: center;
  font-size: 30px;
  color: #fff;
  position: absolute;
  top: 128px;
  left: 200px;
}

.showcardtext h6 {
  text-align: center;
  font-size: 32px;
  color: #FF6917;
  font-weight: 400;
}

.showcardtext p {
  color: #fff;
  font-size: 28px;
  text-align: center;
  width: 450px;
  margin: auto;
  padding-top: 10px;
}

.cardBtn {
  margin: 10px 40px;
}

.cardcannel {
  width: 200px;
  display: inline-block;
  height: 98px;
  line-height: 98px;
  text-align: center;
  font-size: 36px;
  color: #FF6917;
  background-color: #fff;
  border-radius: 10px;
}

.cardupload {
  width: 440px;
  display: inline-block;
  height: 98px;
  line-height: 98px;
  text-align: center;
  font-size: 36px;
  color: #fff;
  background-color: #FF6917;
  margin-left: 30px;
  border-radius: 10px;
}

.personalpoto {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.personalpoto_box .md-image-reader {
  height: 88px;
  width: 100%;
}

.md-input-item .md-input-item-extra.fixed, .md-input-item .md-input-item-title.fixed {
  width: auto;
}

.driver_hd {
  background-color: #EFEFEF;
  height: 88px;
  line-height: 88px;
  font-size: 26px;
  color: #999;
  padding: 0px 30px;
}

.cardxs_box {
  position: relative;
}

.card_number {
  position: absolute;
  top: 115px;
  left: 300px;
  width: 156px;
  height: 50px;
  border-radius: 6px;
  border: 1px solid rgba(224, 224, 224, 1);
  z-index: 100;
}

.card_number span {
  display: inline-block;
  line-height: 50px;
  height: 50px;
  width: 76px;
  text-align: center;
  overflow: hidden;
}

.card_number span b {
  font-weight: 400;
}

.card_number i {
  height: 40px;
  width: 1px;
  background-color: #999999;
  display: inline-block;
  line-height: 40px;
  position: absolute;
  top: 5px;
  left: 70px;
}

.card_number span img {
  width: 40px;
  position: relative;
  top: 8px;
}

.companynextBtn {
  margin: 40px 20px 0px 20px;
}

.companynextBtn p {
  height: 98px;
  line-height: 98px;
  background-color: #FF6917;
  font-size: 36px;
  color: #fff;
  text-align: center;
  border-radius: 10px;
}

.color_car_box {
  background-color: #fff;
  height: 600px;
  overflow: hidden;
  overflow-y: auto;
}

.color_car {
  height: auto;
}

.color_car ul li {
  height: 88px;
  line-height: 88px;
  padding: 0px 30px;
  border-bottom: solid 1px #E0E0E0;
  font-size: 30px;
  color: #333;
}

.color_car ul li span {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin: 0px 10px;
  position: relative;
  top: 8px;
  right: 10px;
}
</style>
